<?php
/**
 * 小程序接口
 * @author maniac
 */
namespace app\api\controller\v1;

use app\facade\Routine AS RoutineFacade;

class Routine extends Base
{
    /**
     * code2Session 换取用户唯一标识 OpenID 和 会话密钥 session_key
     */
    public function code2Session()
    {
        $post = input('post.');
        if (!$post['code']) {
            return j(1, '请提供用户登录凭证');
        }
        $result = [
            'openid' => RoutineFacade::code2Session($post['code']),
        ];
        return j(0, '获取数据成功', $result);
    }
}
